package com.ysj.mall.controller;

import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class IndexController {
    @GetMapping("/")
    public String login(HttpSession session){
        if (session.getAttribute("user")!=null){
            return "index";
        }
        return "login";
    }
    @GetMapping("hello")
    @ResponseBody
    public String hello(HttpSession session){
        return "hello";
    }
}
